home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / nos042_s / session.h < prev    next >
C/C++ Source or Header  |  1994-09-16  |  3KB  |  119 lines

  1. /*
  2.     -----------------------------------------------------------
  3.     ATARI Version by David Nash - dnash@chaos.demon.co.uk
  4.  
  5.     Added #define POST and __stdargs upload
  6.     Cond out #include hardware.h to prevent definition problems
  7.     -----------------------------------------------------------
  8. */
  9.  
  10. #ifndef    _SESSION_H
  11. #define    _SESSION_H
  12.  
  13. #include <stdio.h>
  14.  
  15. #ifndef    _GLOBAL_H
  16. #include "global.h"
  17. #endif
  18.  
  19. #ifndef    _PROC_H
  20. #include "proc.h"
  21. #endif
  22.  
  23. #if 0
  24. #ifndef _HARDWARE_H
  25. #include "hardware.h"
  26. #endif
  27. #endif
  28.  
  29. #ifndef    _FTPCLI_H
  30. #include "ftpcli.h"
  31. #endif
  32.  
  33. #ifndef    _TELNET_H
  34. #include "telnet.h"
  35. #endif
  36.  
  37. #define    MOREROWS    24    /* rows on screen before --more-- */
  38.  
  39. struct ttystate {
  40.     struct mbuf *line;    /* Line buffer */
  41.     int echo;        /* Keyboard local echoing? */
  42.     int edit;        /* Local editing? */
  43.     int crnl;        /* Translate cr to lf? */
  44. };
  45.  
  46. /* Session control structure; only one entry is used at a time */
  47. struct session {
  48.     int type;
  49. #define    FREE    0
  50. #define    TELNET    1
  51. #define    FTP    2
  52. #define    AX25TNC    3
  53. #define    FINGER    4
  54. #define    PING    5
  55. #define NRSESSION 6
  56. #define    COMMAND    7
  57. #define    MORE    8
  58. #define    HOP    9
  59. #define    TIP    10
  60. #define    PPPPASS    11
  61. #define DIAL    12
  62. #define DQUERY    13
  63. #define DCLIST    14
  64. #define RLOGIN    15
  65.  
  66. #ifdef ATARI
  67. #define POST    16
  68. #endif
  69.  
  70.     char *name;    /* Name of remote host */
  71.     union {
  72.         struct ftpcli *ftp;
  73.         struct telnet *telnet;
  74.     } cb;
  75.     struct proc *proc;    /* Primary session process (e.g., tn recv) */
  76.     struct proc *proc1;    /* Secondary session process (e.g., tn xmit) */
  77.     struct proc *proc2;    /* Tertiary session process (e.g., upload) */
  78.     int s;                /* Primary network socket (control for FTP) */
  79.     FILE *record;        /* Receive record file */
  80.     char *rfile;        /* Record file name */
  81.     FILE *upload;        /* Send file */
  82.     char *ufile;        /* Upload file name */
  83.     struct ttystate ttystate;
  84.     struct screen *screen;
  85.     int input;            /* Input socket */
  86.     int output;            /* Output socket */
  87.     int flowmode;        /* control "more" mode */
  88.     int row;            /* Rows remaining until "more" */
  89.     int morewait;        /* Output driver is waiting on us */
  90.     int cur_pos;        /* Cursor position within input buffer */
  91. };
  92. #define    NULLSESSION    (struct session *)0
  93.  
  94. extern char *Sestypes[];
  95. extern unsigned Nsessions;        /* Maximum number of sessions */
  96. extern struct session *Sessions;    /* Session descriptors themselves */
  97. extern struct session *Current;        /* Always points to current session */
  98. extern struct session *Lastcurr;    /* Last non-command session */
  99. extern struct session *Command;        /* Pointer to command session */
  100.  
  101. /* In session.c: */
  102. void freesession __ARGS((struct session *sp));
  103. struct session *sessptr __ARGS((char *cp));
  104. struct session *newsession __ARGS((char *name,int type));
  105.  
  106. #ifndef ATARI
  107. void upload __ARGS((int unused,void *sp1,void *p));
  108. #else
  109. void __stdargs upload(int unused, void *sp1, void *p);
  110. #endif
  111.  
  112. /* In pc.c: */
  113. void swapscreen __ARGS((struct session *old,struct session *new));
  114.  
  115. extern int16 Lport;
  116. #define    ALERT_EOF    1
  117.  
  118. #endif  /* _SESSION_H */
  119.